package model.macro
{
	
	/**
	 */
	public class Tech
	{
		// Make some techs with anonymous functions? Can we save a function in as3? ie. :
		/**
		 * IRON_SWORD.doSomething(); Probably not? Seems silly
		 * 
		 * I'm thinking we need our techs to have a processPlayer() function. Would be most useful. Also silly.
		 */
		static public const IRON_SWORD:Tech = new Tech(1000, new <Tech>[], null, new <Weapon>[Weapon.SWORD], new <Armor> [Armor.CLOTH]);
		
		private var _cost:int;
		private var _allowed_weapons:Vector.<Weapon>;
		private var _allowed_armors:Vector.<Armor>;
		private var _required_techs:Vector.<Tech>;
		private var _required_buildings:Vector.<Building>;
		
		/**
		 * Create
		 * @param	cost
		 * @param	required_buildings
		 * @param	required_techs
		 */
		public function Tech(cost:int, required_techs:Vector.<Tech>, required_buildings:Vector.<Building> = null, allowed_weapons:Vector.<Weapon> = null, allowed_armors:Vector.<Armor> = null)
		{
			if (required_buildings == null)
				required_buildings = new Vector.<Building>();
			if (allowed_weapons == null)
				allowed_weapons = new Vector.<Weapon>();
			if (allowed_armors == null)
				allowed_armors = new Vector.<Armor>();
			
			_allowed_armors = allowed_armors.concat();
			_allowed_weapons = allowed_weapons.concat();
			_required_buildings = required_buildings.concat();
			_required_techs = required_techs.concat();
			_cost = cost;
		}
		
		/**
		 *
		 */
		public function get allowed_weapons():Vector.<Weapon>
		{
			return _allowed_weapons;
		}
		
		/**
		 *
		 */
		public function get allowed_armors():Vector.<Armor>
		{
			return _allowed_armors;
		}
		
		/**
		 *
		 */
		public function get cost():int
		{
			return _cost;
		}
		
		/**
		 *
		 */
		public function get required_techs():Vector.<Tech>
		{
			return _required_techs;
		}
		
		/**
		 *
		 */
		public function get required_buildings():Vector.<Building>
		{
			return _required_buildings;
		}
	}

}